package com.oktest.measure.http

import com.cali.libcore.http.BaseResult
import com.oktest.measure.entity.*
import okhttp3.MultipartBody
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.*

/**
 * @Author hhh
 * @Date 2020/10/23
 */
interface Api{
    @POST("member/login.json")
    fun login(@Body body: RequestBody):Call<BaseResult<Member?>>

    @POST("member/resetPwd.json")
    fun resetPwd(@Body body: RequestBody):Call<BaseResult<Member?>>

    // 短信验证码
    @GET("verification/code.json")
    fun code(@Query(value = "mobile") mobile: String): Call<BaseResult<String?>>

    // 验证短信验证码
    @POST("verification/validCode.json")
    fun validCode(@Body body: RequestBody):Call<BaseResult<Member?>>

    // 个人信息
    @GET("terminal/personal.json")
    fun personal(@Query("memberId") memberId: String): Call<BaseResult<Person?>>

    // 登出
    @POST("member/logout.json")
    fun logout(@Body body: RequestBody):Call<BaseResult<String?>>

    // /carousel/getAll.json 轮播图
    @GET("carousel/getAll.json")
    fun banner():Call<BaseResult<List<BannerData>?>>
    // /notice/getList.json  通知列表
    @POST("notice/getList.json")
    fun notice(@Body body: RequestBody):Call<BaseResult<List<HomeNotice>?>>
    // /notice/get.json  通知详细
    @GET("notice/get.json")
    fun noticeDetail(@Query(value = "id") id:String):Call<BaseResult<NoticeDetail?>>

    // /plan/task.json 任务列表?
    @GET("plan/task.json")
    fun task():Call<BaseResult<HomeTask?>>

    @GET("plan/download/{id}")
    fun download(@Path("id") taskId: String): Call<ResponseBody?>

    @GET("carousel/show/{id}")
    fun downloadBanner(@Path("id") imageId: String): Call<ResponseBody?>

    // /plan/taskDetail.json 任务详情
    @GET("plan/taskDetail.json")
    fun taskDetail(@Query(value = "id") id: String): Call<BaseResult<HomeTaskDetail?>>

    // /plan/received.json 接受任务 id
    @POST("plan/received.json")
    fun taskReceived(@Body body: RequestBody): Call<BaseResult<Received?>>

    // /plan/completed.json 完成任务 id
    @POST("plan/completed.json")
    fun taskComplete(@Body body: RequestBody): Call<BaseResult<String?>>

    // /task/feedback.json 反馈问题
    @POST("task/feedback.json")
    fun taskFeedback(@Body body: RequestBody): Call<BaseResult<String?>>

    @Multipart
    @POST("file/upload")
    fun feedbackFile(@Part files: List<MultipartBody.Part>): Call<BaseResult<FeedbackFile?>>

    @Multipart
    @POST("file/upload")
    fun uploadFile(@Part file: MultipartBody.Part): Call<BaseResult<FeedbackFile?>>

    @POST("task/check.json")
    fun check(@Body body: RequestBody): Call<BaseResult<String?>>

    // /task/result.json 对量结果
    @POST("task/result.json")
    fun checkResult(@Body body: RequestBody):Call<BaseResult<List<MeasureResult?>>>

    // s为1表示这个mid的所有调试量都调试通过，为0表示未全部调试通过，这时sub里面是调试通过的measureid
    @POST("task/syncStatus.json")
    fun taskSyncStatus(@Body jsonBody: RequestBody):Call<BaseResult<List<MeasureSyncResult>?>>
}